package cn.lutu.lutu.controller;

import cn.lutu.lutu.mapper.SpotMapper;
import cn.lutu.lutu.pojo.dto.SpotDTO;
import cn.lutu.lutu.pojo.entity.Spot;
import cn.lutu.lutu.pojo.vo.SpotVO;
import cn.lutu.lutu.response.ResultVO;
import cn.lutu.lutu.service.SpotService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 判断该用户登录状态 是否有权限进行以下操作
 * */
@Slf4j
@Api(tags = "景区产品功能")
@RestController
@RequestMapping("/v1/spots/")
public class SpotController {
    @Autowired
    SpotService spotService;

    @Autowired
    SpotMapper mapper;
    @ApiOperation(value = "添加景区产品功能")
    @PostMapping("add")
    public ResultVO insert(@RequestBody SpotDTO spotDTO){
        spotService.insert(spotDTO);
        return ResultVO.ok();
    }
    @ApiOperation(value = "修改景区产品功能")
    @PostMapping("update")
    public ResultVO update(@RequestBody SpotDTO spotDTO){
        spotService.update(spotDTO);
        return ResultVO.ok();
    }
    @ApiOperation(value = "删除景区产品功能")
    @PostMapping("/{id}/delete")
    public ResultVO delete(@PathVariable Long id){
        spotService.delete(id);
        return ResultVO.ok();
    }
    @ApiOperation(value = "查询景区产品功能")
    @GetMapping("/{id}/select")
    public ResultVO select( @PathVariable Long id){
        return spotService.select(id);
    }


}
